

def showme(req, file=""):

    # show the code

    import os
    import PyFontify, py2html

    dir, x = os.path.split(req.filename)
    ls = os.listdir(dir)

    if file:
	fname, ext = os.path.splitext(file)
	if file not in ls or ext != ".py":
	    return "Very clever!"

	f = open(os.path.join(dir,file))
	s = f.read()
	f.close()

	pp = py2html.PrettyPrint(PyFontify.fontify)
	html = pp.filter(s)
    else:
	doc = DdbDoc()
	doc.bgcolor = "#ffffff"
	doc.title = "Source Code"
	doc.append(H(1, "Click on a file below:"))
	ul = UL()
	for file in ls:
	    fname, ext = os.path.splitext(file)
	    if ext == ".py":
		ul.append(A(url="showme?file=%s" % file, text=file))
	doc.append(ul)
	    
	html = str(doc)

    return html
